//
//  FZLShareView.m
//  Diary
//
//  Created by lanou3g on 15/11/9.
//  Copyright © 2015年 王艺拓. All rights reserved.
//

#import "FZLShareView.h"

@implementation FZLShareView

- (instancetype)initWithFrame:(CGRect)frame
{
    if ([super initWithFrame:frame]) {
        [self addSubViews];
    }
    return [super initWithFrame:frame];
}

- (void)addSubViews
{

    UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
    UIVisualEffectView *blurView = [[UIVisualEffectView alloc]initWithEffect:effect];
    blurView.frame = self.frame;
    [self addSubview:blurView];
    
    // 滑动
    UIScrollView *shareScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, self.frame.size.height * 0.2 , self.frame.size.width, self.frame.size.height * 0.15)];
    shareScrollView.contentSize = CGSizeMake(self.frame.size.width * 1.2,self.self.frame.size.height * 0.15);
    shareScrollView.contentOffset = CGPointMake(0, 0);
    shareScrollView.showsHorizontalScrollIndicator = NO;
    [blurView addSubview:shareScrollView];
    
    // 分享到新浪的按钮
    self.shareSinaButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.shareSinaButton.frame = CGRectMake(self.frame.size.width * 0.05, 13, self.frame.size.width * 0.2, self.frame.size.width * 0.2);
    [self.shareSinaButton setBackgroundImage:[UIImage imageNamed:@"weibo"] forState:UIControlStateNormal];
    [shareScrollView addSubview:self.shareSinaButton];
    
    
    // 保存到相册
    self.saveToPhotoButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.saveToPhotoButton.frame = CGRectMake(CGRectGetMaxX(self.shareSinaButton.frame) * 1.1, 13, self.frame.size.width * 0.2, self.frame.size.width * 0.2);
    [self.saveToPhotoButton setBackgroundImage:[UIImage imageNamed:@"photo_album"] forState:UIControlStateNormal];
    [shareScrollView addSubview:self.saveToPhotoButton];
    
    UILabel *dirLabel = [[UILabel alloc]initWithFrame:CGRectMake(kScreenWidth * 0.075, 64, kScreenWidth * 0.3, 30)];
    dirLabel.text = @"将本篇内容:";
    dirLabel.textColor = [UIColor whiteColor];
    NSInteger fontSize = 18;
    dirLabel.font = [UIFont boldSystemFontOfSize:fontSize];
    [blurView addSubview:dirLabel];
    
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    
    [UIView animateWithDuration:0.3 animations:^{
      self.alpha = 0;  
    }];
    
}

@end
